#pragma  once
#ifndef CONTEXT_TEMPLATE_H
#define  CONTEXT_TEMPLATE_H

#include <maya/MGlobal.h>
#include <maya/MPxContext.h>
#include <maya/MPxContextCommand.h>
#include <maya/MPxToolCommand.h>
#include <maya/MUIDrawManager.h>

#include <maya/MArgDatabase.h>
#include <maya/MSyntax.h>
#include <maya/MColor.h>
#include <maya/MPoint.h>
#include <maya/MStatus.h>

class contextTemplateTool : public MPxToolCommand {
public:
	contextTemplateTool();
	~contextTemplateTool();

	static void *creator();

	static MSyntax newSyntax();
	MStatus parseArgs(const MArgList &args);

	virtual MStatus undoIt() override;
	virtual MStatus redoIt() override;
	virtual MStatus doIt(const MArgList &args) override;

	virtual MStatus cancel() override;
	virtual MStatus finalize() override;

	virtual bool isUndoable() const override;
	virtual bool hasSyntax() const override;

	// customs
	void setIntProperty(int new_property);
	void setFloatProperty(float new_property);
	void setBoolProperty(bool new_property);

private:
	int intProperty;
	double doubleProperty;
	bool boolProperty;
};

class contextTemplate : public MPxContext {
public:
	contextTemplate();
	~contextTemplate();

	void toolOnSetup(MEvent & event) override;

	virtual MStatus doPress(MEvent &event, MHWRender::MUIDrawManager &drawMgr,
		const MHWRender::MFrameContext &context) override;
	virtual MStatus doRelease(MEvent &event, MHWRender::MUIDrawManager &drawMgr,
		const MHWRender::MFrameContext &context) override;
	virtual MStatus doDrag(MEvent &event, MHWRender::MUIDrawManager &drawMgr,
		const MHWRender::MFrameContext &context) override;

	virtual void getClassName(MString &name) const override;

	// customs
	void setIntProperty(int new_property);
	void setDoubleProperty(float new_property);
	void setBoolProperty(bool new_property);

	int getIntProperty();
	float getDoubleproperty();
	bool getBoolproperty();

private:
	short startPos_x, startPos_y;
	short endPos_x, endPos_y;

	int intProperty;
	float doubleProperty;
	bool boolProperty;

	contextTemplateTool *contextTool;
};

class contextTemplateCmd : public MPxContextCommand {
public:
	contextTemplateCmd();
	~contextTemplateCmd();

	static void *creator();

	virtual MStatus doEditFlags() override;
	virtual MStatus doQueryFlags() override;
	virtual MPxContext *makeObj() override;
	virtual MStatus appendSyntax() override;

protected:
	contextTemplate *context;
};

#endif // !CONTEXT_TEMPLATE_H


